import { useContext } from 'react'

import { GlobalContext } from '../context'
import defaultLocale from '../locale'

function useSystemLocale(locale = null) {
  const { systemLanguage } = useContext(GlobalContext)

  return (locale || defaultLocale)[systemLanguage] || {}
}

export default useSystemLocale
